package com.eastcom.bm.atom;

import java.io.Serializable;
import java.lang.reflect.Field;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@IdClass(DataAbnormalPK.class)
@Table(name="QA_DATA_ABNORMAL")
public class DataAbnormal implements Serializable{
	
	private Date dataTime;
	
	private String title;
	
	private String abnormalType;
	
	private String neType;
	
	private String kpiId;
	
	private String neId;
	
	private String datasetId;
	
	private Date timeStamp;
	
	private String abnormalDesc;
	
	private String state;

	private Double integrityRatio;
	
//	private String id;
	
	private Double avgHistoryvalue;
	
	private Double value;

	private Integer dimensionNum;
	
	private String kpiCN;
	
//	@Id
//	public String getId() {
//		return id;
//	}
//
//	public void setId(String id) {
//		this.id = id;
//	}

	@Column(name="INTEGRITY_RATIO")
	public Double getIntegrityRatio() {
		return integrityRatio;
	}

	public void setIntegrityRatio(Double integrityRatio) {
		this.integrityRatio = integrityRatio;
	}

	@Column(name="ABNORMAL_DESC")
	public String getAbnormalDesc() {
		return abnormalDesc;
	}

	public void setAbnormalDesc(String abnormalDesc) {
		this.abnormalDesc = abnormalDesc;
	}

	@Column(name="ABNORMAL_TYPE")
	public String getAbnormalType() {
		return abnormalType;
	}

	public void setAbnormalType(String abnormalType) {
		this.abnormalType = abnormalType;
	}

	@Id
	@Column(name="KPI_ID")
	public String getKpiId() {
		return kpiId;
	}

	public void setKpiId(String kpiId) {
		this.kpiId = kpiId;
	}
	
	//@GenericGenerator(name = "DataAbnormal-uuid", strategy = "assigned")
	//@GeneratedValue(generator = "DataAbnormal-uuid")
	@Id
	@Column(name="DATASET_ID")
	public String getDatasetId() {
		return datasetId;
	}

	public void setDatasetId(String datasetId) {
		this.datasetId = datasetId;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="DATA_TIME")
	public Date getDataTime() {
		return dataTime;
	}

	public void setDataTime(Date dataTime) {
		this.dataTime = dataTime;
	}
	
	@Id
	@Column(name="NE_ID")
	public String getNeId() {
		return neId;
	}

	public void setNeId(String neId) {
		this.neId = neId;
	}

	@Column(name="NE_TYPE")
	public String getNeType() {
		return neType;
	}

	public void setNeType(String neType) {
		this.neType = neType;
	}

	@Column(name="STATE")
	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Id
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name="TIME_STAMP")
	public Date getTimeStamp() {
		return timeStamp;
	}

	public void setTimeStamp(Date timeStamp) {
		this.timeStamp = timeStamp;
	}

	@Column(name="TITLE")
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name="AVG_HISTORYVALUE")
	public Double getAvgHistoryvalue() {
		return avgHistoryvalue;
	}
	
	public void setAvgHistoryvalue(Double avgHistoryvalue) {
		this.avgHistoryvalue = avgHistoryvalue;
	}
	
	@Column(name="VALUE")
	public Double getValue() {
		return value;
	}

	public void setValue(Double value) {
		this.value = value;
	}
	
	@Column(name="DIMENSION_NUM")
	public Integer getDimensionNum() {
		return dimensionNum;
	}

	public void setDimensionNum(Integer dimensionNum) {
		this.dimensionNum = dimensionNum;
	}
	
	@Column(name="KPI_CN")
	public String getKpiCN() {
		return kpiCN;
	}

	public void setKpiCN(String kpiCN) {
		this.kpiCN = kpiCN;
	}
	
	@Override
	public String toString() {
		StringBuffer buf=new StringBuffer();
		for(Field f:this.getClass().getDeclaredFields()){
			try {
				buf.append(f.getName()+"  :  "+f.get(this)).append("  , ");
			} catch (IllegalArgumentException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			} catch (IllegalAccessException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}		
		return buf.toString();
	}

}


